USE [NANS21V]
GO

/****** オブジェクト: Scalar Function [dbo].[Biko] スクリプト日付: 2014/04/16 16:19:42 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

USE [NANS21V]
GO
/****** オブジェクト:  UserDefinedFunction [dbo].[Biko]    スクリプト日付: 04/24/2014 14:43:12 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Biko]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[Biko]


GO
CREATE FUNCTION [dbo].[Biko]
(
	@SYUMOKUKUBUN int,
	@KIROKU1 decimal(9,3),
	@KIROKU2 decimal(9,3),
	@PLUS1 int,
	@PLUS2 int,
	@EXTEND1_1 VARCHAR(64),
	@EXTEND1_2 VARCHAR(64)
)
RETURNS VARCHAR(16)
AS
BEGIN
	DECLARE @return varchar(16)
	IF ((@SYUMOKUKUBUN = 1 OR @SYUMOKUKUBUN = 6) AND (@KIROKU1 = @KIROKU2) AND (@PLUS1 = @PLUS2) AND (@EXTEND1_1 = @EXTEND1_2))
		SET @return = '同記録'
	ELSE IF ((@KIROKU1 = @KIROKU2) AND (@PLUS1 = @PLUS2))
		SET @return = '同記録'
	ELSE
		SET @return = ''
	RETURN @return
END
